package com.zhijiaoyun.controller;

import com.zhijiaoyun.common.DsConstant;
import com.zhijiaoyun.controller.base.BaseController;
import com.zhijiaoyun.model.dto.OrderDto;
import com.zhijiaoyun.model.dto.PageList;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @author shisfish
 * @date 2018/1/19
 */
@Controller
@RequestMapping(value = "/order", produces = "application/json; charset=utf-8")
public class OrderController extends BaseController {

    /**
     * 未有此功能
     *
     * @param pageIndex
     * @param status
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/orderList", method = RequestMethod.GET)
    public Map<String, Object> orderList(int pageIndex, int pageSize, int status) {
        Map<String, Object> map = new HashMap<>();
        PageList<OrderDto> orders = orderService.getOrderDtoByUserId(pageIndex, DsConstant.PAGESIZE_DEFAULT, 0, 0);
        map.put("list", orders.getList());
        map.put("page", orders.getPageData());
        map.put(DsConstant.CODE, DsConstant.CODE_SUCCESS);
        return map;
    }

}
